function value(t)
	local i = 0
	
	return	function()	
		i = i + 1;
		return t[i]
	end
end

t = {10, 20, 30}
iter = value(t)
iter2 = value(t)
while true do
	local element = iter()
	if nil == element then
		break
	end
	print(element)
	print(iter2())
end

for v in value(t) do
	print(v)
end

for key in ipairs(t) do
	print(t[key])
end